package discount;

import impl.Calculate;

/**
 * 注入折扣实现类调用方法计算优惠价格
 */
public class FruitContext {

    private Calculate calculate;

    public void setCalculate(Calculate calculate) {
        this.calculate = calculate;
    }

    public Double calculateFruitPrice(Double price, Enum<?> EnumValue) {
        if (calculate == null || EnumValue == null) {
            return price;
        }
        return calculate.CalculateFruit(price, EnumValue);
    }
}
